package com.MonkWorks.timedormitoryDB;
/**
 * This is an interface for timeDB.java
 */
import java.io.IOException;
import java.util.HashMap;
import java.util.List;

import com.MonkWorks.clockDTO.ClockActivity;
import com.MonkWorks.clockDTO.Job;
import com.MonkWorks.clockDTO.User;

import android.location.Location;
import android.text.format.Time;

public interface ItimeProvider {

	/**
	 * Persist User, clockIn, jobID, and location
	 * 
	 * @param User
	 *            the current logged in user
	 * @param clockin
	 *            the current time Eastern Standard
	 * @param jobID
	 *            user's entered jobID
	 * @param latitude
	 * 
	 * @param logitude
	 * 
	 * @throws Exception
	 */
	public void clockIn(User user, String time, Job job, double Latitude,
			double Longitude) throws Exception;

	/**
	 * Persist User, clockOut, jobID, and location
	 * 
	 * @param User
	 *            the current logged in user
	 * @param clockOut
	 *            the current time Eastern Standard
	 * @param jobID
	 *            user's entered jobID
	 * @param latitude
	 * 
	 * @param longitude
	 * 
	 * @throws Exception
	 */
	public void clockOut(User user, String time, Job job, double Latitude,
			double Longitude) throws Exception;

	/**
	 * 
	 * @return jobs based on userid
	 * @throws Exception
	 */
	public List<String> fetchJobByUser(String username) throws Exception;

	/**
	 * 
	 * @param Username
	 * @param Password
	 * @return true if valid user
	 * @throws Exception
	 */
	public boolean Logon(String Username, String Password) throws Exception;

	/**
	 * Fetches user
	 * 
	 * @param username
	 * @returns user object including type
	 * @throws Exception
	 */
	public User fetchUserByUsername(String username) throws Exception;

	/**
	 * 
	 * @param user
	 *            saves user object
	 * @return
	 * @throws Exception
	 */
	public void saveUser(User user) throws Exception;

	/**
	 * save job object
	 * 
	 * @param job
	 * @throws Exception
	 */
	public void saveJob(Job job, User user) throws Exception;

	/**
	 * 
	 * @return all jobs
	 */
	public List<String> fetchAllJobs();

	/**
	 * Creates an admin account if none is found in the local database
	 */
	public void generateAdmin() throws Exception;

	/**
	 * 
	 * @param name
	 * @return job object list
	 */
	public List<Job> findJobByName(String name);

	/**
	 * 
	 * @param name
	 * @return activity list
	 * @throws IOException
	 */
	public List<String> findActivityByJob(String name) throws IOException;
	
	/**
	 * Finds all users
	 * @return list of all usernames
	 */
	public List<String> fetchAllUsers();
	
	/**
	 * Updates User account
	 * @param password
	 * @param firstName
	 * @param lastName
	 */
	public void updateUser(String username, String password, String firstName, String lastName, String email) throws Exception;

	/**
	 * Checks to see if user is clocked in already
	 * @param job
	 * @returns true if Job isn't clocked in yet
	 */
	public boolean clockCheck(Job job);
	
	/**
	 * Checks to see if user is clocked out already
	 * @param job
	 * @returns true if Job isn't clocked out yet
	 */
	public boolean clockOutCheck(Job job);
}
